package com.lin.cloud.disk.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.cloud.disk.entity.pojo.UserDepartment;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (UserDepartment)表数据库访问层
 *
 * @author ljc
 * @since 2020-12-10 16:48:13
 */
@Repository
public interface UserDepartmentMapper extends BaseMapper<UserDepartment> {

    /**
     * 通过用户ID查询部门ID列表
     * @param userId
     * @return
     */
    List<Long> selectDepartmentIdListByUserId(Long userId);


    /**
     * 通过部门ID列表查询用户ID列表
     * @param departmentIdList
     * @return
     */
    List<Long> selectUserIdListByDepartmentIdList(@Param("departmentIdList") List<Long> departmentIdList);


    /**
     * 批量插入用户部门关系
     * @param userDepartmentList
     */
    void batchInsertUserDepartment(@Param("userDepartmentList") List<UserDepartment> userDepartmentList);

    /**
     * 批量删除用户部门关系
     * @param departmentId
     * @param unAllocationUserList
     */
    void batchRemoveUserDepartment(@Param("departmentId") Long departmentId, @Param("unAllocationUserList") List<Long> unAllocationUserList);
}